//
//  PTDrawViewController.m
//  PuTie
//
//  Created by 周宏全 on 2017/7/14.
//  Copyright © 2017年 周宏全. All rights reserved.
//

#import "PTDrawViewController.h"
#import "Masonry.h"
#import "UIColor+HMAddition.h"

@interface PTDrawViewController ()

@end

@implementation PTDrawViewController {
    UIView *_drawView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor hm_colorWithHex:0xefefef];
    
    // 调用设置“画板”视图的方法
    [self setDrawView];
    
}

#pragma mark - 设置”画板“视图
- (void) setDrawView {
    
    // 创建显示尺寸的Label
    UILabel *sizeLabel = [[UILabel alloc] init];
    // 文字
    sizeLabel.text = @"X:00mm  Y:00mm  宽:100mm  高:50mm";
    // 文字颜色
    sizeLabel.textColor = [UIColor blackColor];
    // 文字字体大小
    sizeLabel.font = [UIFont systemFontOfSize:14];
    // 添加到父视图
    [self.view addSubview:sizeLabel];
    // 设置frame
    [sizeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(self.view).offset(12);
    }];
    
    
    
    // 创建“画板”的View
    _drawView = [[UIView alloc] init];
    // 设置画板的背景颜色
    _drawView.backgroundColor = [UIColor whiteColor];
    // 将画板添加到父视图
    [self.view addSubview:_drawView];
    // 设置画板约束
    [_drawView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(sizeLabel.mas_bottom).offset(12);
        make.left.equalTo(self.view).offset(16);
        make.right.equalTo(self.view).offset(-16);
        make.bottom.equalTo(self.view.mas_bottom).offset(-18);
    }];
    // 绘制圆角
    _drawView.layer.cornerRadius = 8;
    _drawView.layer.masksToBounds = YES;
    
}


@end
